package com.cat.model.web.action.common;

import com.cat.model.common.util.ErrorCode;
import com.cat.model.web.action.base.BaseAction;

public class ExceptionAction extends BaseAction{

	private static final long serialVersionUID = 1907312590472335668L;
	private int info;
	public String stack(){
		System.out.println("###ExceptionAction stack.....................");
		System.err.println(request.getAttribute("exceptionStack"));
		return null;
	}
	
	//token过期
	public String tokenExpire() {
		this.print(ErrorCode.TOKEN_ERROR.resultJson());
		return null;
	}
	
	@SuppressWarnings("unused")
	public String handle(){
		Object ret = request.getAttribute("ret");
		Object errmsg = request.getAttribute("errmsg");
		Object cmd = request.getAttribute("cmd");
//		ResultJson resultJson = new ResultJson();
//		if(ret != null){
//			resultJson.setRet((Integer)ret);
//		}else {
//			resultJson.setRet(500);
//		}
//		if(errmsg != null){
//			resultJson.setMsg((String)errmsg);
//		}
//		if(cmd != null){
//			resultJson.setCmd((String)cmd);
//		}
//		this.print(resultJson.toString());
		return null;
	}
	
	public String home(){
		System.out.println("ExceptionAction..................................home");
		return null;
	}
	
	public String exce(){
		System.out.println("ExceptionAction..................................e");
		if(info == 1){
			throw new RuntimeException("ExceptionAction...");
		}
		return null;
	}
	
	@SuppressWarnings("unused")
	private void aaa(){
		if(info == 1){
			throw new RuntimeException();
		}
	}

//	public Exception getException() {
//		return exception;
//	}
//	
//	public void setException(Exception exception) {
//		this.exception = exception;
//	}

	public int getInfo() {
		return info;
	}

	public void setInfo(int info) {
		this.info = info;
	}

	public String getErrmsg() {
		return errmsg;
	}

	public void setErrmsg(String errmsg) {
		this.errmsg = errmsg;
	}
	
}
